import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BuildingFloorVO, BuildingFloorForm, BuildingFloorQuery } from '@/api/dormitory/buildingFloor/types';

/**
 * 查询宿舍楼-楼层列表
 * @param query
 * @returns {*}
 */

export const listBuildingFloor = (query?: BuildingFloorQuery): AxiosPromise<BuildingFloorVO[]> => {
  return request({
    url: '/dormitory/buildingFloor/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询宿舍楼-楼层详细
 * @param id
 */
export const getBuildingFloor = (id: string | number): AxiosPromise<BuildingFloorVO> => {
  return request({
    url: '/dormitory/buildingFloor/' + id,
    method: 'get'
  });
};

/**
 * 新增宿舍楼-楼层
 * @param data
 */
export const addBuildingFloor = (data: BuildingFloorForm) => {
  return request({
    url: '/dormitory/buildingFloor',
    method: 'post',
    data: data
  });
};

/**
 * 修改宿舍楼-楼层
 * @param data
 */
export const updateBuildingFloor = (data: BuildingFloorForm) => {
  return request({
    url: '/dormitory/buildingFloor',
    method: 'put',
    data: data
  });
};

/**
 * 删除宿舍楼-楼层
 * @param id
 */
export const delBuildingFloor = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dormitory/buildingFloor/' + id,
    method: 'delete'
  });
};
